package com.ruoyi.car.api;

import com.ruoyi.car.api.bo.WxLoginBo;
import com.ruoyi.car.api.bo.WxRegisterBo;
import com.ruoyi.car.api.vo.WxLoginVo;
import com.ruoyi.car.service.IWxUserService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 微信用户相关接口
 */
@RestController
@RequestMapping("/wx/user")
public class WxUserApiController extends BaseController {
    @Autowired
    private IWxUserService wxUserService;

    /**
     * 注册
     *
     * @param registerBo
     * @return
     */
    @PostMapping(value = "/register")
    public AjaxResult register(@RequestBody WxRegisterBo registerBo) {
        wxUserService.register(registerBo);
        return success();
    }

    /**
     * 登录
     *
     * @param wxLoginBo
     * @return
     */
    @PostMapping(value = "/login")
    public AjaxResult login(@RequestBody WxLoginBo wxLoginBo) {
        WxLoginVo login = wxUserService.login(wxLoginBo);
        return success(login);
    }


}
